import axios from "@/libs/api.request";
class BasicRules {
  queryList(params) {
    return axios.request({
      url: '/eventsrule/queryList',
      method: 'post',
      data: params
    })
  }
  queryById(params) {
    return axios.request({
      url: '/eventsrule/getone',
      method: 'post',
      data: params
    })
  }

  editList(params) {
    if (params.ruleId) {
      let data = _.pick(params, ['ruleId', 'ruleName', 'kindCode', 'niandu'])
      return axios.request({
        url: '/eventsrule/editList',
        method: 'post',
        data
      })
    }
    return axios.request({
      url: '/eventsrule/add',
      method: 'post',
      data: params
    })
  }
  edit(params) {
    return axios.request({
      url: '/eventsrule/edit',
      method: 'post',
      data: params
    })
  }
  updateStatus(params) {
    if (params.status === "0") {
      return axios.request({
        url: '/eventsrule/start',
        method: 'post',
        data: {
          ruleId: params.id,
          kindCode: params.kindCode
        }
      })
    }
    return axios.request({
      url: '/eventsrule/stop',
      method: 'post',
      data: params.id
    })
  }
  del(params) {
    return axios.request({
      url: '/eventsrule/del',
      method: 'delete',
      data: params
    })
  }
  // 导入名次
  importRank(params) {
    return axios.request({
      url: '/eventsrule/importRank',
      method: 'post',
      data: params
    })
  }
  // 导入阵容值
  importTeam(params) {
    return axios.request({
      url: '/eventsrule/importTeam',
      method: 'post',
      data: params
    })
  }
  // 导入阵容加分
  importTeamScore(params) {
    return axios.request({
      url: '/eventsrule/importTeamScore',
      method: 'post',
      data: params
    })
  }
  // 获取 贡献值
  getDevote() {
    return axios.request({
      url: '/sofContribution',
      method: 'put'
    })
  }
  // 编辑/添加 贡献值
  optDevote(params) {
    return axios.request({
      url: '/sofContribution',
      method: 'post',
      data: params
    })
  }
   // 删除 贡献值
  delDevote(id) {
    return axios.request({
      url: `/sofContribution/${id}`,
      method: 'delete',
    })
  }
  // 名次是否重复
  repeatDevote(params) {
    return axios.request({
      url: '/sofContribution/rank',
      method: 'post',
      data: params
    })
  }
}
export default BasicRules
